home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
Dev
/
gcc263-c.lha
/
gnu
/
README-2.6.3
< prev
Wrap
Text File
|
1994-12-11
|
34KB
|
872 lines
Short: gcc v2.6.3 - C/C++/ObjC Compiler set for AmigaDOS
Type: dev/gcc
Uploader: phb@colombo.telesys-innov.fr
Author: phb@colombo.telesys-innov.fr
This directory contains the 2.6.3 release of the GNU C compiler.
The GNU C compiler is free software. See the file COPYING for copying
permission.
===============
How to get help
===============
There's an amiga-gcc mailing list running in Finland, read README-LIST file.
This is the preferred place to ask for help since I'm on this list and
every GCC developers also, libnix & ixemul authors, etc...
Short: send an email to listserv@lists.funet.fi, and put in body:
subscribe amiga-gcc-port your_first_name your_last_name
Otherwise you can contact me at:
Philippe BRAND
Fidonet: Ramses The Amiga Flying BBS 2:320/104.21
Email: phb@colombo.telesys-innov.fr (ONLY for personal email).
Ftp: colombo.telesys-innov.fr:/pub/amigados-gnu
or /pub/incoming/uploads for uploads.
Note: I'll forward any question to this mailing-list, but please use it
directly, except when you send files, in this case send them to my ftp site.
Note2: ftp.funet.fi mirrors my amigados-gnu tree. Using ftp.funet.fi is
preferable as they have much more bandwidth.
============
Requirements
============
- Systems:
Any Amiga (ranging from A1000 up to A4000/40, including CD-32 & SX-1) will
run amigados-gnu utilities.
- Memory:
A minimum of 4MB free memory is needed in order to compile small/medium
projects.
More memory will be needed for large projects, such as recompiling gcc
itself.
Gigamem is known to work with GCC so *maybe* less memory will work. But in this
case, you'll need an MMU equiped amiga (A3000,A4000/40, etc...).
VMM40 (Public Domain Virtual memory manager) is also known to work with GCC.
- OS:
Starting from this release, 1.3 systems are not longer supported.
Gcc runs fine on all other systems, starting from 2.04 up to 3.1 (40.68).
- Disk Space;
An installation of gcc requires the use of a hard disk. Approximately 10MB is
required at present to install the compiler and utilities required to use it.
In addition 3MB is required for the Commodore Developer Kit, which is required
to be able to compile AmigaDOS specific programs. This kit is available direct
from Commodore-Amiga.
==========================
What's new in this release
==========================
2.6.3
- Read FSF NEWS-2.6.1 file included.
- As always, generic bugs fixed (see Changelog in gcc sources for details).
- q_anote package replaced by FSF listing shell script, need awk.
- new as/ld/size/nm/ranlib, made by Raphael Luebbert
- new environnement variables GCCPRIORITY and GCCSTACK, see below.
- all programs recompiled using 2.6.3 compiler.
- mit2mot & mot2mit, convert asm syntax between Motorala and MIT syntaxes.
- all programs hold AmigaDOS compatible $VER string.
=================================
What was new in previous releases
=================================
2.6.2
- internal release only.
2.6.1
- Read FSF NEWS-2.6.1 file included.
- As always, generic bugs fixed (see Changelog in gcc sources for details).
- new option -priority in gcc allowing process priority setting.
- new specs file, inlines/protos and libamiga done by Gunther Nikl. See note
below.
- new libnix version by Matthias Fleischer & Gunther Nikl.
- new ixemul version by Raphael Luebbert.
- stripc program to strip all uneccessary stuff from headers by Chris Metcalf,
submitted by Lars Hecking.
- q_anote, anotate assembly files mixing C source code, submitted by Walter
Harms (Walter.Harms@arbi.informatik.uni-oldenburg.de), written by
Mike Albaugh (albaugh@agames.com). See note below.
- new assembler, as-2.5, using new BFD (Binary File Descriptor), made by
Raphael Luebbert.
2.6.0
- Read FSF NEWS-2.6.0 file included.
- Extensive internal compiler bugs fixed (see ChangeLog in gcc sources for
details), tons of bugs fixed for C++ support.
- ld changed (see note for ld below).
- new ixemul.library, with optimized versions for accelerated Amigas, see
README-ixemul & ixemul.guide for more informations.
- new C library (libnix) disabling use of ixemul.library for generated
programs (best use for AmigaDOS specific programs). Full ANSI compliant, see
README-libnix & libnix.guide for more informations.
- revised inline headers in accordance with new ixemul.library.
- libamiga.a is now distributed with gcc-2.6.1.
- as v2.3 is included, along with a macro-assembler (gasp).
- stderrfix.o (see below) patch applied.
- Upgrade to libg++-2.6.
- Gcc now supports $VER string for AmigaDOS version compatibility.
2.5.8
- Read FSF NEWS-2.5.8 file included.
- ld behavior over symbols changed (see note below).
- added flavors so that linker will take appropriate libraries according to
gcc options (m68020 libraries/baserel libraries, etc...).
- gpc (GNU-Pascal) v1.03 added.
- all utilities recompiled with gcc-2.5.8.
- plain 68000 and 68020+68881 versions of all binaries available.
- More internal compiler bugs fixed (see ChangeLog in gcc sources for details),
some for C++ support.
- GCC-Install script fixed by Claus Deckhut (to be used with full distrib).
- Upgrade to libg++-2.5.3.
- trace.c updated by J. Hoehle to avoid buffer overflows.
2.5.7:
- Read FSF NEWS file included.
- More internal compiler bugs fixed (see ChangeLog in gcc sources for details),
a lot for C++ support.
- Fred Fish seems to have finally found an annoying bug which prevented
to compile a resident version of GCC, or to compile resident programs. But
don't try it anyway 'cause there's still lack of library support as for now.
- Man command now works, this one was my fault (well in fact like others ;-),
fix done by Tom Haiko.
- Infoview works also, it was an internal path problem.
- libamy.a HAS TO BE RENAMED to libamiga.a because new ld won't find libamy.a
- upgrade to new C++ library v2.5.1.
=======
Authors
=======
Gcc v2.2.2 port: Markus Wild
Gcc v2.3.3 port: Markus Wild
Gcc v2.4.5 port: Philippe Brand, Lars Hecking, Fred Fish
Gcc v2.5.0 and up: Philippe Brand, Fred Fish, Leonard Norrgard
Ixemul.library: Markus Wild, Leonard Norrgard, Raphel Luebbert,
Stephan Isthesin.
Libnix: Matthias Fleischer, Gunther Nikl
Thanks to all amiga-gcc-port mailing-list users for their reports and support
for a better amigados-gcc and documentation.
=======
Sources
=======
These archives should contain everything necessary to get you going, they
don't include sources for all tools (have a look at end of paragraph).
As stated by Richard Stallman of the FSF:
"The GPL says that any distribution of binaries must contain either the
source code or a written offer to supply source code (see the GPL for
details of what is required)."
If you're interested in the sources required to rebuild gcc, get the
gcc263-src.lha, which hold sources for gcc. Those archives should be stored
either the same ftp site you got this binary distribution from (if they're
not, tell the manager of that ftp site, as this is a requirement of the
GNU Copyright LICENSE), either at ftp.gnu.ai.mit.edu:/pub/gnu, either on
Ramses BBS (phone numbers listed below).
If you have those archives, you can skip to next paragraph. If you have
original FSF sources, you'll have to apply the gcc patch-file in src-patches/,
and configure for `amigados'. Please note that you should have at least 40MB
left or your HD and 8MB of memory minimum in order to rebuild gcc up to stage3.
An accelerated Amiga is welcome, as it took me 4,5 hours to generate a single
pass. So 3 passes makes 4,5 x 3 = 13,5 hours.
Sources for other tools only included as binaries are available separately
in self-contained archives, usually having their name into the archive-name.
File What
gcc263-src.lha C/C++/ObjC compiler sources & diff file
libnix-0.6.lha libnix sources and binaries
ixemul-40.4-src.lha ixemul sources and libraries
binutils-1.8.x-src.lha Sources for ld
binutils-2.5.2-src.lha Sources for ar/ranlib & diff file
gdbm-1.7.3-src.lha Sources for gdbm & diff file
make-3.71-src.lha make sources & diff file
patch-2.1-src.lha patch sources, needed to apply diff files
sed-2.05-src.lha sed sources & diff file
gawk-2.15.5-src.lha GNU awk sources & diff file
diffutils-2.7-src.lha diff utility sources & diff file
fileutils-3.11-src.lha file utilities sources & diff file
sh-utils-1.12-src.lha shell utilities sources & diff file
textutils-1.11-src.lha text utilities sources & diff file
findutils-4.1-src.lha find sources & diff file
grep-2.0-src.lha grep sources & diff file
bison-1.22-src.lha bison (yacc replacement) sources & diff file
flex-2.4.7-src.lha flex (lex replacement) sources & diff file
texinfo-3.1-src.lha texinfo (includes makeinfo) sources & diff file
gzip-1.2.4-src.lha gzip sources & diff file
tar-1.11.2-src.lha gtar sources & diff file
cpio-2.3-src.lha cpio sources & diff file
gdbm-1.7.3-src.lha database manip. library sources & diff file
termcap-1.2-src.lha termcap library sources & diff file
libm-5.6-src.lha BSD mathematic library sources & diff file
NOTE:
All sources archives are amiga ready, and amiga specific diff file located
in 'amiga' directory. To recompile a tool, just run a 'configure amigados'
then a 'make'.
Exceptions are libnix, ixemul which have their own archives, both binary &
sources. On Aminet sites, libnix & ixemul in /pub/amiga/dev/gcc.
=====
Where
=====
**** All GNU sources & binaries are available on:
- ftp.telesys-innov.fr, primary Amiga-GNU FTP site, and its mirror ftp.funet.fi
which is MUCH faster than my own site. Please use it at first choice.
in /pub/amigados-gnu
- Aminet sites (wuarchive.wustl.edu and mirrors such as ftp.luth.se)
in /pub/amiga/dev/gcc
- Ramses The Amiga Flying BBS +33-1-60037015 HST Dual v32 terbo 4800-21600
+33-1-60037713 SupraFax v32bis 4800-14400
+33-1-60037716 Tornado v22bis 1200-2400
in Topic "Development", Area "Gcc"
- FreshFish CDs from Fred Fish Amiga Library Services
in :GNU/bin, :GNU/src, :GNU/lib dirs. 610 N. Alma School Road, Suite 18
Chandler, AZ 85224-3687
USA
Fax: (602) 917-0917 (no voice phone
orders, FAX only)
**** GNU source code is available on:
- same FTP site you've taken these archives
- gnu.prep.ai.mit.edu 18.71.0.38
in /pub/gnu
- Ramses The Amiga Flying BBS
in Topic "AmigaUnix/Unix/Linux/NetBSD", Area "Gnu Source Code"
- FreshFish from Fred Fish
in :GNU/src
======
Layout
======
Gcc-2.6.3 is split up into 15 archives:
gcc263-readme.lha holds readmes files (include installation notes).
gcc263-base.lha basic gcc distribution, hold necessary files.
gcc263-inclib.lha headers and libraries.
gcc263-c.lha C compiler.
gcc263-c-020.lha 68020+68881 version of C compiler.
gcc263-c++.lha C++ compiler, headers and libraries.
gcc263-c++-020.lha 68020+68881 versions of C++ compiler.
gcc263-objc.lha Objective-C compiler, header and libraries.
gcc263-objc-020.lha 68020+68881 versions of Objective-C compiler.
gcc263-doc.lha Gcc AmigaGuide(tm) documents & manpages.
gcc263-utils.lha Useful utilities needed for development.
gcc263-utilsdoc.lha Utilities documentation (guide & manpages).
gcc263-texi.lha All Texinfo documents.
gcc263-diffs.lha Diff files for all binaries.
gcc263-src.lha Source for gcc-2.6.3 plus diff file.
Name What Where
---- ---- -----
COPYING GNU LICENSE, read!! All archives
COPYING.LIB GNU LIBRARY LICENSE, read!! All archives
README-2.6.3 this file All archives
NEWS-2.6.3 What's new in gcc-2.6.3 gcc263-base
Installer Commodore installer utility gcc263-base
GCC-Install Installer script to configure gcc All archives
envarc/ global environment variables you should
have set when using this programming gcc263-base
environment
include/ non-amiga specific C/C++ headers gcc263-inclib
os-include/proto amiga specific protos headers. gcc263-inclib
os-include/inline amiga specific inline C headers. Add gcc263-inclib
Commodore headers!!
os-lib/ amiga specific libraries gcc263-base
guide/ Docs in AmigaGuide(tm) format gcc263-doc
man/ this is the root for tons of man pages gcc263-doc
bin/ this is /bin, and contains all gcc263-c
binaries of this distribution that gcc263-c++
are meant to be directly invoked by gcc263-utils
the user (contrary to the executables
in lib/gcc-lib/, that are meant to be
invoked by a driver program like gcc)
lib/ normal (not base relatives) libraries gcc263-inclib
lib/libm020/ normal 68020 libraries gcc263-inclib
lib/libb/ base relatives libraries gcc263-inclib
lib/libb/libm020/ base relatives using 68020 libraries gcc263-inclib
lib/libnix/ Non-ixemul libraries gcc263-inclib
lib/libm020/libnix/ Non-ixemul 68020 libraries gcc263-inclib
lib/libb/libnix/ Non-ixemul base relatives libraries gcc263-inclib
lib/libb/libm020/libnix Non-ixemul base relatives 68020 libs gcc263-inclib
lib/gcc-lib/ home of compilers called by gcc gcc263-c
gcc263-c++
gcc263-objc
ixpipe/ a pipe handler needed by the library gcc263-base
libs/ ixemul.library gcc263-base
rexx/ ARexx wrappers for gcc and g++ gcc263-base
src-patches/ source patches gcc263-diffs
geninline/ Perl scripts to generate inline headers gcc263-inclib
and -lamy glue
==============
Inline-Headers
==============
Since I'm not able to redistribute amiga header files, you will have to get
them directly from Commodore, unless you're an official registrated Amiga
developer. In order to generate inline-headers, follow these steps (provided
amiga headers and fd files are in os-include). You don't have to generate them
if you use OS3.1 (40.13 headers).
1) First method:
CLI> stack 100000
CLI> Assign INCLUDE: GCC:os-include
CLI> Assign FD: INCLUDE:fd
CLI> Makedir INCLUDE:inline
CLI> cd USR:bin/geninline
CLI> gen31
This will create all inline-headers. If you have 2.0 headers, use gen20
instead, if you have 3.0, use gen30, if you have 6.4, send it to me ;-)
NOTE: perl scripts do not handle correctly AmigaDOS include files, which
seems to mean they are somewhat broken. If someone could work on this...
2) Second method:
Use fd2inline, which you can find on Aminet in dev/gcc.
===============
Amiga Libraries
===============
Starting from this release an AmigaDOS compliant library is provided,
thanks to libnix authors (Matthias Fleischer and Gunther Nikl).
Anyway if you want to rebuild one, there are two methods:
1) Using hunk2gcc; the AmigaDOS object converter made by Markus Wild. To
achieve this, simply grab a copy of latest amiga.lib (from Commodore
Development Kit) and make a new directory where you want your converted
object files to go, cd into it, and enter
hunk2gcc amiga.lib [..further libs if you like..]
This generates an a.out object file for every program unit present in the
hunk file (in this case, from amiga.lib).
As the final step convert all those files into an a.out style library by
issuing:
ar qc libamiga.a obj.*
ranlib libamiga.a
The ranlib run builds a symbol table in the archive, and makes accesses to
the library much faster.
2) Creating a libamiga.a library with libnix is fairly easy, but takes some
time. Just uncompress sources.lha from libnix distribution and run a
'make libamiga.a'.
NOTE:
As long as you make no AmigaDOs specific calls, you can create a dummy library
using:
cat "int dummy;" >dummy.c
gcc -c dummy.c
ar crv libamiga.a dummy.o
mv libamiga.a gcc:lib
A small libamiga.a (dummy) is also provided with libnix.
============
Installation
============
1) If this is your first installation of GCC, follow these steps;
- You need first to create a directory gnu on your hard-disk and unarchive
first part:
CLI> cd place_with_lot_of_space
CLI> makedir gnu
CLI> lha x gcc263-base.lha
- Now you have to append gnu/s/user-startup to your s:user-startup file
(replace Devel:GNU by your own gnu path). Execute it in order to get new
assigns:
CLI> execute gnu/s/user-startup
- Copy gnu/envarc to ENVARC:
CLI> copy gnu/envarc/#? ENVARC:
- C-compiler is needed so unarchive C compiler part (Users with
accelerated amigas can unarchive gcc263-c-020 part instead) :
CLI> lha x gcc263-c.lha (or gcc263-c-020)
- If you want to have Gcc documentation on-line, unarchive doc part:
CLI> lha x gcc263-doc.lha
- If you want to do C++, unarchive C++ part (Users with
accelerated amigas can unarchive gcc263-c++-020 part instead) :
CLI> lha x gcc263-c++.lha (or gcc263-c++-020)
Please not that 68020+68881 versions have '.020' extension in GNU:bin.
- If you want to do Objective-C, unarchive Objective-C part (Users with
accelerated amigas can
unarchive gcc263-objc-020 part instead) :
CLI> lha x gcc263-objc.lha (or gcc263-objc-020)
- If you want additional utilities (recommended for Unix compatibility),
unarchive utils part:
CLI> lha x gcc263-utils.lha
- If you want all utilities documentation no-line, unarchive utils-doc
part:
CLI> lha x gcc263-utilsdoc.lha
- Because some programs are normally link to others, please run script:
CLI> sh /gnu/s/restorelinks
Or if you don't want to use makelink but rather copy file, run script:
CLI> sh /gnu/s/restorelinks copy
- If you want to rebuild all distribution, you'll have to unarchive
diff part:
CLI> lha x gcc263-diffs.lha
- If you want to build Postscipt files for Gcc documention, unarchive
texinfo part:
CLI> lha x gcc263-texi.lha
- Now skip to next paragraph and happy compiling!
2) If you "upgrade" your gcc environment from v2.5.x, just unarchive first
2 archives as it would normally include all what you need (thus gcc263-base
and gcc263-c). Make sure you delete your previous ixemul.library
wherever it is (usually LIBS:).
NOTE: new version of ixemul.library is provided, make sure you don't have
another copy somewhere which may conflict with gcc.
=============================
Your first C program with gcc
=============================
What about a nice Hello World ?
#include <stdio.h>
main()
{
printf("Hello World!\n");
}
This was pretty simple ;-) Now we have to compile it.
There's a lot of options in gcc but simplest way to compile this would be:
CLI> gcc -o hello hello.c
Simple ?
Here's more options.
Target processor for Motorola family:
You can compile plain 68000 code, 68020, 68030, 68040, 68881 (have a look at
GCC documentation, either in info or AmigaGuide format, chapter Invoking Gcc/
SubModel Options/M680X0 Options for Motorola specific compilation flags).
CLI> gcc -m68020 -m68881 -o hello hello.c
This will compile your programs using 68020 code and direct calls to
math-processor, and will link with accelerated libraries, located in
GCC:lib/lib020.
Optimization:
Either you don't want optimization, or you can provide -O, which will
optimize your code, or if you really want top optimization, use -O2 flag (for
more discussion about optimization, read info or AmigaGuide doc chapter
Invoking Gcc/Optimize Options). There's now even a -O3 optimization option,
which will go even further.
CLI> gcc -O2 -o hello hello.c
You'll never have a "Hello World" program running so fast ;-)
Code generation:
Perhaps you want to generate resident programs.
Flag is -resident, at compile and link stage.
CLI> gcc -resident -o hello hello.c
Of course you can mix all options, resulting in:
CLI> gcc -O2 -m68020 -m68881 -resident -o hello hello.c
This will make a 68020+68881 executable highly optimized and resident.
IMPORTANT:
If you only use AmigaDOS functions or you don't want to use ixemul for
philosophical reasons, you can get rid of ixemul.library with:
CLI> gcc -noixemul -o foobar foobar.c
provided you have libnix distribution (included with 2.6.3 distribution).
================
Ixemul vs Libnix
================
Starting with 2.6.1 version of amigados-gcc, two C libraries are provided.
First one is using ixemul.library Amiga shared-library at run-time. This
library makes it possible to easily convert Unix(tm) programs to AmigaDOS,
and made for example possible gcc on AmigaDOS. Have a look at ixemul.guide
for further informations.
Second one is an ANSI-C compliant library which is better suited for
AmigaDOS specific development, thus not using any Unix specific routines.
Note that you can develop AmigaDOS specific programs with ixemul.library,
but at the cost of an extra 200KB memory taken by shared library.
===============================
Redirection with ixemul.library
===============================
A common problem seen with amigados-gcc is bad redirection to sderr.
The fact is that ixemul.library takes stderr from the pr_CES field
in the process structure. The field was added in 2.0. If the field
is not set, then ixemul uses stdout, instead. The trouble is that this
field must be set by the shell, and the only shell that does so is
WShell!
The rationale behind ixemul.library working this way is that
"run <NIL: >NIL: cmd" will detach your process from the terminal, so
that you can close the initial CLI window after startup.
In any case, there is a workaround for the problem that was posted to the
list a while back: compile your main program using the -Dmain=mymain
option, then link with stderrfix.o to provide the actual main that will
do the magic that creates an stderr stream that is different from
stdout. Along with the C version a C++ version is included and was used to
compile groff.
Thanks to Kriton Kyrimis for this explanation and patch.
stderr fixes can be found in GNU:stderrfix (srcs-) and GNU:lib (.o files).
=====
ARexx
=====
The provided ARexx scripts have been contributed by Loren J. Rittle.
If you like ARexx, they're an alternate way of calling gcc. They
automatically make sure you're using a large enough stack setting, and
enable you to compile C++ programs with less obscure options. This
approach is furthermore useful if you're not able to use the g++ /bin/sh
script.
===============
gcc versus gccv
===============
gccv stands for a gcc using vfork() to spawn a new process, and then calling
the new execve() function in ixemul.library to call its subcompilers. Gcc
continues to using the more system friendly RunCommand() function in
dos.library to start subcompilers. Gccv has the advantage of being able to
work with interprocess pipes, thus (provided you have the memory ;-)), you're
able to do
gccv -pipe your_program.c
causing the preprocessor (cpp), the C-compiler (cc1) and the assembler (as)
to run at the same time, passing intermediate files thru internal pipes
instead of using temporary files.
As long as you don't want that feature (ok, playing with certain make tools
also requires gccv) you're safe using gcc.
==========
stack size
==========
You need to have a 50.000 stack size in order to compile with GCC. This should
be enough for most projects. Note than while recompiling gcc with itself it
has taken more than 300KB stack. Stack can grow due to source complexity.
Don't be afraid of it.
To set the stack size, see the AmigaDOS Command 'stack'.
To use ar and/or ranlib, 50KB is the minimum acceptable. You should have a
much larger stack, if you use larger libraries.
Starting with 2.6.3 a new environnement variable, GCCSTACK, enables gcc to
read this variable and set stack upon startup. Thus now no need to set stack
to huge values, only gcc/ld/cpp/cc1#? will automatically set new stack,
according to GCCSTACK variable.
Simply commit a:
setenv GCCSTACK value
to set gcc stack to value.
Benefits: huge memory savings.
========
priority
========
Starting also with 2.6.3 a new environnement variable, GCCPRIORITY, let you
specify a default process priority for GNU compiler. Setting it to -1 enable
your Amiga to do something else while compiling :-)
===========
C++ headers
===========
With AmigaDOS it makes no difference whether a name has capital or lower-case
letters in names when finding files (i.e. it is case insensitive), you'll
certainly run into problems with some headers, including String.h and normal
string.h. My suggestion for now is to add to C++ "faulty" header filename an
"_" in front of it, thus String.h would become _String.h. Sorry for
inconvenience. (thanks to Dirk Nehring for reminding me this anoying
"feature").
=======
Patches
=======
Includes:
Jörg Höhle
hoehle@inf-wiss.uni-konstanz.de
There is a conflict between the Amiga and the UNIX definition of the
timeval structure. Markus Wild proposed in gcc233 to patch the Amiga
devices/timer.h file so that it loads the UNIX sys/time.h file (and
thus tons of other files) (see os-include/devices/timer.mwild.path). I
suggest that sys/time.h and devices/timer.h be modified to detect each
other and use whichever structure was declared first (see
os-include/devices/timer.jch.patch). The supplied include/sys/time.h
file works this way. You can apply the patches with the program patch
or by hand. The original devices/timer.h file is copyrighted by
Commodore-Amiga and not included, but here is the patch:
+ #ifndef _SYS_TIME_H_
+ /* Use whatever was included first, standard (sys/time.h) or Amiga
+ * includes (jch). */
struct timeval {
ULONG tv_secs;
ULONG tv_micro;
};
+ #else
+ #define tv_secs tv_sec
+ #define tv_micro tv_usec
+ #endif
The sys/types.h defined BPTR causing conflicts with Amiga includes. I
removed the BPTR definition from sys/types.h and sys/proc.h. In
gcc233, there was no such definition either.
I moved the ixemul.h file from include/ to the ixemlib/library/
directory. The ixemlib/ directory could contain the ixemul.library
sources. In the ixemul source tree, ixemul.h is found in the library/
directory. Furthermore I patched it so that it is now able to compile
a working ixconfig. It was broken (because of the broken ixemul.h) in
gcc252/3/4. It previously worked in gcc233 but didn't provide the -e
option. The ixemlib/library/version.h is an empty fake. I don't have a
newer ixemul.h file.
There's yet another minor patch I'd like to suggest:
*** include/stdlib.h.orig Mon Aug 10 15:28:54 1992
--- include/stdlib.h Fri Dec 09 17:12:38 1993
***************
*** 72,76 ****
--- 72,80 ----
void *calloc __P((size_t, size_t));
div_t div __P((int, int));
+ #if 0
void volatile exit __P((int));
+ #else /* new ANSI-C interpretation */
+ typedef void exit_t __P((int)); volatile exit_t exit;
+ #endif
void free __P((void *));
char *getenv __P((const char *));
===============
Ld (GNU linker)
===============
Starting from 2.5.8 release, ld behavior over symbols has changed. Default is
now to strip all symbols from generated executable ONLY if environment variable
LDSTRIP is set (to whatever you want). Otherwise, '-s' flag will strip symbols,
as usual.
Also packing of uninitialized data will be done automatically if LDSHORTDATA is
set (to whatever you want).
Ld also knows about -chip and -fast keywords, gcc will soon handle them
directly.
Ld is using now flavors, which are generated depending on gcc flags:
Gcc option Flavor passed to ld
-m68020 -fl libm020
-noixemul -fl libnix
-resident -fl libb
Thus ld when searching for libraries, add to search library path those flavors,
in alphabetical order. Normal search path is /gnu/lib, and if for example you
want to compile using -m68020 -noixemul ld will look for libgcc.a in:
/gnu/lib/libm020/libnix
first, then will reduce flavors, one by one, if it can't find required library
in flavor's expanded path. This means that it will try to find libgcc.a in:
/gnu/lib/libm020
and in /gnu/lib/. because libgcc.a exists in /gnu/lib/libm020, ld will take
this one.
There is as for now 8 possibilities:
Flavors Search path
libb libm020 libnix
0 0 0 /gnu/lib/ normal
0 0 1 /gnu/lib/libnix/ non-ixemul
0 1 0 /gnu/lib/libm020/ normal 68020
0 1 1 /gnu/lib/libm020/libnix/ non-ixemul 68020
1 0 0 /gnu/lib/libb/ baserel
1 0 1 /gnu/lib/libb/libnix/ baserel non-ixemul
1 1 0 /gnu/lib/libb/libm020/ baserel 68020
1 1 1 /gnu/lib/libb/libm020/libnix/ baserel 68020 non-ix
Using this approach makes adding flavors pretty easily, if someone wants for
example to add 68881 libraries, a new flavor will hve to be created, libm881,
and thus maximum level flavor search path would be:
/gnu/lib/libb/libm020/libm881/libnix, which can be translated in english as:
"I want a base-relative library compiled using Motorola 68020 and coprocessor
68881, not using ixemul.library".
=====================
gcc and its "pragmas"
=====================
From Gunther Nikl:
Accessing operating-system functions on the amiga requires to pass arguments
in specific processor registers. C, however, uses a different calling convention:
it pushes all arguments in reverse order onto the stack, calls the function and
finally removes the arguments from the stack by simply correcting the stack pointer.
One solution to interface C and the calling convention for the system-functions are
so called "glue"-functions that convert arguments passed on the stack into the
os-function convention. These glue routines are located for all system libraries
in a link library named libamiga.a. Obviously this method is inefficient. Most
amiga c-compilers have the capability of in-line calls to os functions using
a c language extension "#pragma". The format of a pragma statement and file names
differ from compiler to compiler. gcc supports in-line calls too but not with
pragmas. the gcc solution is based on the fact that gcc is able to integrate small
functions into the caller. This method is known from c++ as "inlining". Thus
functions that are declared "inline" (peferable in conjunction with the keyword
static or extern but see the next chapter) get integrated. As you can see writing
programs that compile with several compilers and use its capability of making
in-line calls to libraries is a tricky thing.
To get programs more portable between amiga c-compilers a new set of include files
would be helpful that hide the diffrent methods for in-line calls from the user.
These files are located in a drawer called proto eg. "proto/exec.h". Instead of
writing (only an example!):
#include <clib/exec_protos.h>
#ifdef __GNUC__
#include <inline/exec.h>
#endif
now the following should be used:
#include <proto/exec.h>
to achieve the same result! Nice, isn't it? The general rule for the all files is:
#include <proto/xxx.h>
with "xxx" replaced with the first part of a clib proto-headers name eg.
"exec_protos.h" becomes "exec.h"
In general each file first includes its function prototype header then the compiler
specific "pragma" header and finally declares the library base extern. The gcc files
are in the following format:
(1) include some C= headers to prevent errors with gcc
(2) include the function prototypes from the clib drawer
(3) include the inline header if this is not disabled and if optimizing
(4) declare the library base extern if its not disabled
Step 3 will only be executed if gcc is optimizing. Otherwise the compiler won't
integrate any function. Even when optimizing it could be not desired to include
the inline header because it requires some amount of memory and the compile time
enlarges significantly. Therefore step 3 can be disabled with:
- a define on the commandline "-D__NOINLINES__"
or
- a define before the proto headers are included "#define __NOINLINES__"
Declaring the library base as an external variable can disabled with a define in
the same way. The define is called "__NOLIBBASE__". This define can be useful if
its not desired to have the library base declared extern.
Using the new proto headers has some advantages then using the clib and inline
files by itself:
(1) better compatibility with SAS/C. It should be much easier to compile
programs developed for SAS/C with gcc - almost ;) no need to adjust
includes
(2) almost ;) optimal code because depending on the optimization level
the best suited include set will be used
(3) internal compiler specific requirements are hidden from the user
For the exec.library the proto header has one additional goodie: it "implements"
SAS/C "__USE_SYSBASE". Defining this forces to evaluate the absolute address 4
every time the library base for the exec.library is required. In this case no
global library base is necessary but it must be noted that programs compiled with
this option enabled can have performance problems because AbsExecBase is located
in Chip-Memory. Be aware: if using __USE_SYSBASE its *NOT* legal to declare or
define SysBase! If you do so strange things may happen ... Please note that some
function in libamiga.a require a global "SysBase" so that those functions cannot
be used.
Some problems still remain but these restrictions come from the inline technique.
Library bases have to be global due to the nature of the inlines. SAS/C, however,
is able to use local variables or structure elements as library bases. In this case
the library bases has to be made global for gcc.
inline headers
One major advantage of gcc is its ability to integrate simple functions into the
caller. To direct the compiler to inline a function the keyword "inline" in
combination with "static" or "extern" can be used. Previous version of the inlines
used static in the definition. This had the effect that functions compiled to
assembler if optimization is disabled. The new inline headers use extern definitions.
Functions defined inline and extern can be considered as macros. That means the
definition is only used for inlining thus requiring linking with a library containing
stubs.